package com.gopay.common.domain.user.identify;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.gopay.common.cipher.utils.SensitiveInfoUtils;
import com.gopay.common.domain.BaseEntity;

/**
 * 身份证已用额度日志
 * 
 * @PersIdUsedQuotaLog.java
 * @author dak.wang
 * @2016年5月25日 下午2:26:14 www.gopay.com.cn Inc.All rights reserved.
 */
@Entity
@Table(name = "PERS_ID_USED_QUOTA_LOG")
public class PersIdUsedQuotaLog extends BaseEntity {

    private static final long serialVersionUID = 1L;

    private Long id;
    private String custId; // 客户ID
    private String certNo;// 身份证号码
    private String gopayIntTxnCd;// 国付宝内部交易码 (交易类型)
    private BigDecimal amt;// 金额
    private String gopayOrderId;// 国付宝系统订单号
    private BigDecimal quotaBeforeAmt;// 修改前余额
    private BigDecimal quotaAfterAmt;// 修改后余额
    private String accountType;// 三类账户类别 01-一类账户 02-二、三类账户
    private String createdOperId;
    private Date createdTs;
    private String lastUpdOperId;
    private Date lastUpdTs;
    private Integer version;

    @Id
    @SequenceGenerator(name = "PERS_ID_USED_QUOTA_LOG_SEQ_GENERATOR", sequenceName = "PERS_ID_USED_QUOTA_LOG_SEQ", allocationSize = 1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "PERS_ID_USED_QUOTA_LOG_SEQ_GENERATOR")
    @Column(name = "ID")
    public Long getId() {
        return id;
    }

    @Column(name = "CERT_NO", length = 150)
    public String getCertNo() {
    	 this.certNo = SensitiveInfoUtils.autoReencrypt(this.certNo);
         return SensitiveInfoUtils.smartDecryptWithCheck(this.certNo);
    }

    @Column(name = "CUST_ID", length = 10)
    public String getCustId() {
        return custId;
    }

    @Column(name = "GOPAY_INT_TXN_CD", length = 10)
    public String getGopayIntTxnCd() {
        return gopayIntTxnCd;
    }

    @Column(name = "AMT", precision = 20, scale = 2)
    public BigDecimal getAmt() {
        return amt;
    }

    @Column(name = "GOPAY_ORDER_ID", length = 10)
    public String getGopayOrderId() {
        return gopayOrderId;
    }

    @Column(name = "QUOTA_BEFORE_AMT", precision = 20, scale = 2)
    public BigDecimal getQuotaBeforeAmt() {
        return quotaBeforeAmt;
    }

    @Column(name = "QUOTA_AFTER_AMT", precision = 20, scale = 2)
    public BigDecimal getQuotaAfterAmt() {
        return quotaAfterAmt;
    }

    @Column(name = "ACCOUNT_TYPE", length = 10)
    public String getAccountType() {
        return accountType;
    }

    @Column(name = "CREATED_OPER_ID", length = 10)
    public String getCreatedOperId() {
        return createdOperId;
    }

    @Column(name = "CREATED_TS")
    @Temporal(TemporalType.TIMESTAMP)
    public Date getCreatedTs() {
        return createdTs;
    }

    @Column(name = "LAST_UPD_OPER_ID", length = 10)
    public String getLastUpdOperId() {
        return lastUpdOperId;
    }

    @Column(name = "LAST_UPD_TS")
    @Temporal(TemporalType.TIMESTAMP)
    public Date getLastUpdTs() {
        return lastUpdTs;
    }

    @Column(name = "VERSION", precision = 22, scale = 0)
    public Integer getVersion() {
        return version;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public void setCertNo(String certNo) {
    	  this.certNo = SensitiveInfoUtils.smartEncryptWithCheck(certNo);
    }

    public void setCustId(String custId) {
        this.custId = custId;
    }

    public void setGopayIntTxnCd(String gopayIntTxnCd) {
        this.gopayIntTxnCd = gopayIntTxnCd;
    }

    public void setAmt(BigDecimal amt) {
        this.amt = amt;
    }

    public void setGopayOrderId(String gopayOrderId) {
        this.gopayOrderId = gopayOrderId;
    }

    public void setAccountType(String accountType) {
        this.accountType = accountType;
    }

    public void setCreatedOperId(String createdOperId) {
        this.createdOperId = createdOperId;
    }

    public void setCreatedTs(Date createdTs) {
        this.createdTs = createdTs;
    }

    public void setLastUpdOperId(String lastUpdOperId) {
        this.lastUpdOperId = lastUpdOperId;
    }

    public void setLastUpdTs(Date lastUpdTs) {
        this.lastUpdTs = lastUpdTs;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public void setQuotaBeforeAmt(BigDecimal quotaBeforeAmt) {
        this.quotaBeforeAmt = quotaBeforeAmt;
    }

    public void setQuotaAfterAmt(BigDecimal quotaAfterAmt) {
        this.quotaAfterAmt = quotaAfterAmt;
    }

}
